{
  "properties" : { },
  "id" : "e5b9bdef9b1840b8947dab6dc905265a",
  "script" : null,
  "groupId" : "a7109e8f35c343dfa8220583ef254707",
  "name" : "查询菜单",
  "createTime" : 1714063372048,
  "updateTime" : 1712229818803,
  "lock" : null,
  "createBy" : "管理员",
  "updateBy" : "管理员",
  "path" : "tree",
  "method" : "GET",
  "parameters" : [ ],
  "options" : [ {
    "name" : "permission",
    "value" : "system:cdgl",
    "description" : "允许拥有该权限的访问",
    "required" : false,
    "dataType" : "String",
    "type" : null,
    "defaultValue" : null,
    "validateType" : null,
    "error" : null,
    "expression" : null,
    "children" : null
  } ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : null,
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : null
}
================================
import com.alibaba.fastjson.JSONObject;
import com.gitee.fastmybatis.core.query.Query;
import com.gitee.fastmybatis.core.query.Sort;

import 'com.wiwf.model.mapper.admin.dao.SysMenuMapper' as sysMenuMapper;
import '@/system/getDataNode' as getDataNode;

var query = new Query();
query.orderby("sort", Sort.ASC).orderby("menu_id", Sort.ASC)

var baseDatas = sysMenuMapper.list(query);

// get data tree
var treeData = [];
for (data in baseDatas) {
  var tData = JSONObject.toJSON(data)
  
  getDataNode(baseDatas, tData, "menuId", "parentId");

  if(tData.parentId == 0){
    treeData.add(tData);
  }
}

return treeData;